package com.itheima.tlias84.aspect;

import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

/**
 *  @Aspect 标识切面类
 * @Component 加上这个变成spring 容器中的bean 能够让bean类使用bean类
 */
@Aspect
@Component
@Slf4j
public class LogAspect {


    @Around("@annotation(com.itheima.tlias84.annotaion.Log)") //自定义注解
    public Object inserLog(ProceedingJoinPoint point) throws Throwable {
         //执行父类方法
        Object proceed = point.proceed();
        log.info("操作{}方法插入日志",point.getSignature().getName());
        return proceed;
    }

}
